home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / plain / contrib / split.tex < prev    next >
Encoding:
Text File  |  1992-08-26  |  2.0 KB  |  49 lines

  1. %%%------------------------rrrrrrrrrrrrrrip!--------------------------
  2. % Macro: \xsplit
  3. % By: Eric Skinner <ERS2F@UOTTAWA>
  4. % Function: Takes two pieces of text, and boxes them side by side.
  5. %           Column widths and inter-column gap are set by user.
  6. % Parameters:
  7. %   #1: Width of first column, including unit specification
  8. %   #2: Width of space between columns, including units
  9. %   #3: Width of second column, including units
  10. %   ** Warning: Don't exceed page dimensions!
  11. %   #4: First column text.
  12. %   #5: Second column text.
  13. % Registers: \box1,\box2
  14. \def\xsplit#1#2#3#4#5{{
  15.   \setbox1=\vbox{\hsize= #1 #4}    % First column
  16.   \setbox2=\vbox{\hsize= #3 #5}    % Second column
  17.   % If the boxes are output side by side at this point, they
  18.   % will be aligned at the bottom instead of the top.
  19.   \ifdim\ht2>\ht1   % Column two is longer than column one
  20.     % Fill bottom of column one with glue
  21.     \setbox1=\vbox to \ht2{\hsize= #1 #4 \vfill}
  22.   \else
  23.     \ifdim\ht1>\ht2   % Column one is longer than column two
  24.       % Fill bottom of column two with glue
  25.       \setbox2=\vbox to \ht1{\hsize= #3 #5 \vfill}
  26.     \fi
  27.   \fi
  28.   \hbox{\box1\hskip#2\box2}}}
  29. %%%------Cut some more------------------------------------------------
  30. % Macro: \split
  31. % By: Eric Skinner <ERS2F@UOTTAWA>
  32. % Function: Takes two pieces of text, and boxes them side by side.
  33. %           Column widths are set by user.  Inter-column gap is
  34. %           automatically adjusted to make the first column flush
  35. %           with the left margin, and the second flush with the right.
  36. % Parameters:
  37. %   #1: Width of first column, including unit specification
  38. %   #2: Width of second column, including units
  39. %   ** Sum of #1 and #2 should not exceed current \hsize!
  40. %   #3: First column text. Don't do anything REALLY weird.
  41. %   #4: Second column text.
  42. % Registers: \dimen1
  43. \def\split#1#2#3#4{
  44.   \dimen1=\hsize
  45.   \advance\dimen1 by -#1
  46.   \advance\dimen1 by -#2
  47.   \xsplit{#1}{\dimen1}{#2}{#3}{#4}}
  48. %%%------------Tear----------------------------------------------------
  49.